package com.ruoyi.cderp.controller;

import com.ruoyi.cderp.domain.TblTakeStockConfig;
import com.ruoyi.cderp.service.IProductStockService;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

/**
 * @author 何赞飞
 * @date 2025/2/28 8:48
 * @description
 **/
@RestController
@RequestMapping("/system/stock")
public class ProductStockController extends BaseController {

    @Autowired
    private IProductStockService productStockService;

    /**
     * 获取盘点参数设置数据
     */
    @PreAuthorize("@ss.hasPermi('system:TakeStockConfig:index')")
    @GetMapping("/index")
    public AjaxResult index() {
        return success(productStockService.selectTblTakeStockConfigInfo());
    }

    /**
     * 修改盘点参数设置
     */
    @PreAuthorize("@ss.hasPermi('system:TakeStockConfig:update')")
    @Log(title = "盘点参数设置", businessType = BusinessType.UPDATE)
    @PutMapping("/update")
    public AjaxResult update(@RequestBody TblTakeStockConfig tblTakeStockConfig) {
        return toAjax(productStockService.updateTblTakeStockConfig(tblTakeStockConfig));
    }
}
